select
  accsub.accountSubjectId as accountSubjectId,
  accsub.subjectCode as subjectCode,
  accsub.fullName as fullName,
  subbal.registerTime as registerTime,
  boa.recordTime as recordTime,
  boa.money as boaMoney,
  boa.direction as boaDirection,
  boa.notes as notes,
  subbal.balanceMoney as balanceMoney,
  accsub.direction as subDirection  
 from
  AccountSubjectBoImpl accsub,
  BookOfAccountBoImpl boa,
  SubjectBalanceBoImpl subbal  
 where
  accsub.accountSubjectId          =subbal.accountSubject   
  and boa.bookOfAccountId          =subbal.bookOfAccount   
  and boa.money>0     
  and subbal.registerTime>=?
  and subbal.registerTime<=?
  and accsub.subjectCode=?
order by accsub.accountSubjectId,
         boa.recordTime